<%@page language="java" contentType="text/html; charset=UTF-8" isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="html" tagdir="/WEB-INF/tags" %>
<!DOCTYPE html>
<html>
<html:header title="新增门店">

    <link rel="stylesheet" href="${baseUrl}css/public.css" media="all">
    <style type="text/css">
        .readonly{
            background-color: #eeeeee;
        }

        a{
            color: #01AAED;
            text-decoration: none;
            font-size: 12px;
        }
        a:hover {
            color: #FF5722;
        }
    </style>
    <script>
        jQuery(function () {
            $("[name='no']").attr("readonly","readonly");
            $("[name='no']").addClass("readonly");

            getByType("${baseUrl}",ORDER_TYPE.MD.type, $("[name='no']"),true);


            $(".reloadNo").click(function () {
                getByType("${baseUrl}",ORDER_TYPE.MD.type, $("[name='no']"),true);
            });


            $("#cancel").click(function () {
                closeSubIframe();
            });
        });

        layui.use(['form', 'table'], function () {
            var $ = layui.jquery,
                form = layui.form,
                table = layui.table;

            form.on('submit(save)', function (data) {
                if (data.field.name == "") {
                    tip("名称不能为空");
                    return false;
                }
                if (data.field.no == "") {
                    tip("编号不能为空");
                    return false;
                }

                console.log(JSON.stringify(data.field));

                tipLoad();
                post("${baseUrl}organization/store/add.action?", data.field,function (resp) {
                    closeAll();
                    if (resp.code == 1) {
                        tip("保存成功");
                        refreshMainIframe("${baseUrl}organization/store.action");
                        closeSubIframe();
                    } else {
                        errTip(resp.msg);
                    }
                });
                return false;
            });
        });
    </script>

</html:header>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">
        <form class="layui-form" action="" lay-filter="house">
            <input type="hidden" name="id">

            <div class="layui-form-item">
                <label class="layui-form-label">门店名称</label>
                <div class="layui-input-inline">
                    <input type="text" name="name" placeholder="门店名称" autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">门店编号</label>
                <div class="layui-input-inline">
                    <input type="text" name="no" placeholder="门店编号" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-input-inline" style="padding-top: 10px">
                    <a href="javascript:;" class="reloadNo">重新加载</a>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">联系人</label>
                <div class="layui-input-inline">
                    <input type="text" name="contacts" placeholder="联系人" autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">电话</label>
                <div class="layui-input-inline">
                    <input type="text" name="phone" placeholder="电话" autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">邮箱</label>
                <div class="layui-input-inline">
                    <input type="email" name="email" placeholder="邮箱" autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">邮编</label>
                <div class="layui-input-inline">
                    <input type="text" name="code" placeholder="邮编" autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">地址</label>
                <div class="layui-input-inline">
                    <input type="text" name="address" placeholder="地址" autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">备注</label>
                <div class="layui-input-inline">
                    <textarea name="remark" placeholder="备注" class="layui-textarea"></textarea>
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="save">保存</button>
                    <a class="layui-btn layui-btn-primary" id="cancel">取消</a>
                </div>
            </div>
        </form>
    </div>
</div>

</body>

<html:loading tip="处理中，请稍后..."/>

</html>